<!-- FQA历史记录 -->

<script setup>
import { ref, inject, reactive } from 'vue'
import { ElMessageBox } from 'element-plus'
//引入axios
const axios = inject('axios')

//数据
const testdata = reactive({
  "orderFQARecords": []
})

//发送请求时的附带数据
const Data = reactive({
  "conditions": { "orderNoOrProductionNo": "", "startDate": "", "endDate": "" }
})

//获取所有数据
function selectData() {
  axios({
    method: 'post',
    url: '/api/orderFQARecords/selectAll',
    // data: Data
  }).then((response) => {
    if (response.data.success) {
      if (response.data.map.orderFQARecords != null) {
        testdata.orderFQARecords = response.data.map.orderFQARecords
        console.log("result:")
        console.log(response.data.map)
        console.log("testdata.orderFQARecords:")
        console.log(testdata.orderFQARecords)
        // myData.pageParams = response.data.map.pageParams
      } else {
        ElMessageBox.alert("无首检信息！", '结果')
      }
    } else {
      ElMessageBox.alert(response.data.msg, '结果')
    }
  }).catch((error) => {
    ElMessageBox.alert("系统错误！", '结果')
  })
}
selectData()

//按条件获取数据
function selectData1() {
  console.log("Data:")
  console.log(Data)
  axios({
    method: 'post',
    url: '/api/orderFQARecords/select1',
    data: Data.conditions
  }).then((response) => {
    if (response.data.success) {
      if (response.data.map.orderFQARecords != null) {
        testdata.orderFQARecords = response.data.map.orderFQARecords
        console.log("result:")
        console.log(response.data.map)
        console.log("testdata.orderFQARecords:")
        console.log(testdata.orderFQARecords)
        // myData.pageParams = response.data.map.pageParams
      } else {
        ElMessageBox.alert("无首检信息！", '结果')
      }
    } else {
      ElMessageBox.alert(response.data.msg, '结果')
    }
  }).catch((error) => {
    ElMessageBox.alert("系统错误！", '结果')
  })
}
//表单序号自增
const indexMethod = (index) => {
  return index + 1
}
</script>

<template>
  <el-row style="background-color:white;margin:20px 10px 0 10px">
    <el-col :span="5" style="margin:10px 0 0 10px">
      <el-date-picker v-model="Data.conditions.startDate" type="date" placeholder="审批时间" />
    </el-col>
    <el-col :span="5" style="margin-top:10px">
      <el-date-picker v-model="Data.conditions.endDate" type="date" placeholder="审批时间" />
    </el-col>
    <el-col :span="11" style="margin-top:10px;">
      <el-input v-model="Data.conditions.orderNoOrProductionNo" placeholder="请输入订单编号或生产序号" />
    </el-col>
    <el-col :span="2" style="margin-top:10px">
      <el-button type="success" @click="selectData1">查询</el-button>
    </el-col>
  </el-row>
  <el-row style="background-color:white;margin:0 10px 0 10px">
    <el-col :span="24" style="margin-top:15px">
      <!--:data为测试数据，可对应数据库修改  stripe斑马纹效果 border带边框 -->
      <el-table :data="testdata.orderFQARecords" stripe border style="width:100%">
        <!-- 定义列表属性 prop值可对于数据库字段名修改-->
        <el-table-column label="序号" align="center" type="index" :index="indexMethod" width="50"></el-table-column>
        <el-table-column label="订单编号" align="center" prop="orderNo" width="110" />
        <el-table-column label="生产序号" align="center" prop="productionNo" width="110" />
        <el-table-column label="产品型号" align="center" prop="productModel" width="180" />
        <el-table-column label="产品货号" align="center" prop="productNo" width="120" />
        <el-table-column label="报验数量" align="center" prop="inspectionQuantity" width="60" />
        <el-table-column label="抽检数量" align="center" prop="sampleTestQuantity" width="60" />
        <el-table-column label="报验时间" align="center" prop="inspectionTime" width="110" />
        <el-table-column label="审批时间" align="center" prop="auditTime" width="110" />
        <el-table-column label="报验人" align="center" prop="inspectionApplier" width="80" />
        <el-table-column label="审检人" align="center" prop="auditor" width="80" />
        <el-table-column label="审检状态" align="center" prop="auditState" width="90" />
        <el-table-column label="备注" align="center" prop="remark" />
      </el-table>
    </el-col>
  </el-row>
</template>

<style scoped>

</style>